from pathlib import Path
import time

from the_test import exec, run_test

for hap_path in Path("/home/user/Desktop/rnoh_arts/to_test").glob("*.hap"):

    # which feature/improvement/fix you are testing, part of file name, dont use special character
    experiment_name = "perf_watch_dfx"
    # experiment_name = "benchmark-pgo-after"
    # which scenario to test, if you only want to run one of them, remove others
    scenarios = ["image", "view", "text"]
    # scenarios = ["image"]
    # say round = 64, each of the scenarios will be tested 64 times, totally 192 runs. each run is about 30s
    rounds = 16
    # tested hap bundle name
    # bundle_name = "com.example.myapplication250227"
    # bundle_name = "com.rnoh.tester"
    bundle_name = "com.acts.ace.napitest"

    # tested hap type, blue is opensource version, green is internal version, tester is embedded in rn tester app
    hap_type = "blue"
    # keep battery temperature at this value during testing
    # target_temperature = 27
    target_temperature = 27
    # range of tags to capture slice, use core tag to compare between rooted and not rooted versions, otherwise use usual
    # usual, core, load
    trace_tag_mode = "usual"

    exec(["hdc", "wait-for-device"])
    time.sleep(5)
    exec(["hdc", "uninstall", bundle_name])
    time.sleep(5)
    exec(["hdc", "install", str(hap_path)])
    time.sleep(5)

    run_test(bundle_name, hap_type, experiment_name, scenarios, rounds, target_temperature, trace_tag_mode)

    hap_path.unlink()
